import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SetupVO, SetupForm, SetupQuery } from '@/api/collect/setup/types';
import { InheritData } from "@/api/budget/contrastDept/types";

/**
 * 查询特殊配置列表
 * @param query
 * @returns
 */

export const listSetup = (query?: SetupQuery) => {
  return request({
    url: '/collect/setup/list',
    method: 'post',
    data: query
  });
};

/**
 * 查询特殊配置详细
 * @param id
 */
export const getSetup = (id: string | number): AxiosPromise<SetupVO> => {
  return request({
    url: '/collect/setup/' + id,
    method: 'get'
  });
};

/**
 * 新增特殊配置
 * @param data
 */
export const addSetup = (data: SetupForm) => {
  return request({
    url: '/collect/setup',
    method: 'post',
    data: data
  });
};

/**
 * 修改特殊配置
 * @param data
 */
export const updateSetup = (data: SetupForm) => {
  return request({
    url: '/collect/setup',
    method: 'put',
    data: data
  });
};

/**
 * 删除特殊配置
 * @param id
 */
export const delSetup = (id: string | number | Array<string | number>) => {
  return request({
    url: '/collect/setup/' + id,
    method: 'delete'
  });
};


/**
 * 继承数据
 * @param data
 */
export const saveInheritData = (data: InheritData) => {
  return request({
    url: "/collect/setup/inheritData",
    method: "post",
    data: data
  });

};
